<template>
	<view>
	   <view>
	   	<cu-custom :bgColor="NavBarColor" :isBack="isShow!=1" backRouterName="index">
	   		<block slot="backText" v-if="isShow!=1">返回</block>
	   		<block slot="content">我的团队</block>
	   	</cu-custom>
	   </view>
		  		 
		  <view class="padding flex text-center text-grey bg-white shadow-warp">
		    <view class="flex flex-sub flex-direction solid-right ">
		      <view class="text-xl lines-black"><text class="text-red">{{tdsl}}人</text></view>
			  <view class="margin-top-sm">团队总人数</view>
		    </view>
		   <view class="flex flex-sub flex-direction solid-right " :style="[{animationDelay: '0.2s'}]">
		     <view class="text-xl lines-black"><text class="text-red">{{wdzt}}人</text></view>
		     <view class="margin-top-sm">我的直推</view>
		   </view>  
		</view>
		    
	</view>
</template>

<script>
	import api from '@/api/api'
	export default {
		name: "people",
		props: {
		    isShow: {
		      type: Boolean,
		      default: false
		    }
		  },
		data() {
			return {
				wdzt:0,
				tdsl:0,
						personalList:{
				  avatar:'',
				  realname:'',
				  username:'',
				  post:''
				},
				  positionUrl:'/sys/position/list',
				  departUrl:'/sys/user/userDepartList',
				  userUrl:'/sys/user/queryById',
				  postUrl:'/sys/position/queryByCode',
				  userId:'',
				  id:''
			};
		},
		watch: {
			cur: {
				immediate: true,
				handler() {
					console.log('watch',this.cur)
				    this.userId=this.$store.getters.userid;
					this.load()
				},
			},
		},
		mounted() {
			this.load()
		},
		methods: {
			scan(){
				 console.log("进来了")
				// #ifndef H5
				uni.scanCode({
				    success: function (res) {
						console.log('条码res：' + res);
				        console.log('条码类型：' + res.scanType);
				        console.log('条码内容：' + res.result);
				    }
				});
				// #endif
				// #ifdef H5
				this.$tip.alert("暂不支持")
				// #endif
			},
			load(){
				api.wodetuandui(this.userId).then(response => {
						      if(response.data.code ==200){   
								  	this.tdsl=response.data.result.tdsl
									this.wdzt=response.data.result.wdzt 
						      }else{ 
								let msg = response.data.message || "请求超时"
								this.$tip.alert(msg);  
						      }
				  }).catch(error => {  
					this.$tip.alert("请求超时");
					this.isDisabled = true 
				})
				
			},
			getpost(code){
				if(!code||code.length==0){
					this.personalList.post='员工'
					return false;
				}
				this.$http.get(this.postUrl,{params:{code:code}}).then(res=>{
					console.log("postUrl",res)
					 if (res.data.success) {
						this.personalList.post=res.data.result.name
					}
				}).catch(err => {
					console.log(err);
				});
				
			}
		}
	}
</script>

<style>
.UCenter-bg {
	/* #ifdef MP-WEIXIN */
	/* background-image: url('https://static.jeecg.com/upload/test/blue_1595818030310.png'); */
	/* #endif */
	/* #ifndef MP-WEIXIN */
	/* background-image: url('/static/blue.png'); */
	/* #endif */
  background-size: cover;
  height: 400rpx;
  display: flex;
  justify-content: center;
  padding-top: 40rpx;
  overflow: hidden;
  position: relative;
  flex-direction: column;
  align-items: center;
  color: #fff;
  font-weight: 300;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}

.UCenter-bg text {
  opacity: 0.8;
}

.UCenter-bg image {
  width: 200rpx;
  height: 200rpx;
}

.UCenter-bg .gif-wave{
  position: absolute;
  width: 100%;
  bottom: 0;
  left: 0;
  z-index: 99;
  mix-blend-mode: screen;  
  height: 100rpx;   
}

map,.mapBox{
  left: 0;
  z-index: 99;
  mix-blend-mode: screen;  
  height: 100rpx;   
}

map,.mapBox{
  width: 750rpx;
  height: 300rpx;
}
</style>
